#include<bits/stdc++.h>
#define rnd() abs((int)_rnd())
using namespace std;
inline int read(){
	int x=0;bool f=0;char ch=getchar();
	while(ch<'0'||ch>'9')f^=(ch=='-'),ch=getchar();
	while('0'<=ch&&ch<='9')x=(x<<1)+(x<<3)+(ch^48),ch=getchar();
	return f?-x:x;
}
const int V=1e9;
int n=4000,q=50000;
mt19937 _rnd(time(0));
int main(){
	freopen("fire.in","w",stdout);
	printf("%d %d\n",n,q);
	while(q--){
		int op=rnd()%2+1;
		printf("%d ",op);
		if(op==1){
			printf("%d %d %d %d\n",(rnd()&1),rnd()%n+1,rnd()%4+1,rnd()%V+1);
		}else printf("%d %d\n",rnd()%n+1,rnd()%n+1);
	}
	return 0;
}

